package org.car.world.service.impl;

import java.util.List;

import org.car.world.core.entily.UserTable;
import org.car.world.core.mapper.UserTableMapper;
import org.car.world.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;

@Service
@Transactional(rollbackFor = {RuntimeException.class, Exception.class})
public class UserServiceImpl implements UserService {

    @Autowired
    UserTableMapper userTableMapper;

    @Override
    public int deleteByPrimaryKey(Integer userId) {
        return userTableMapper.deleteByPrimaryKey(userId);
    }

    @Override
    public int insert(UserTable record) {
        return userTableMapper.insert(record);
    }

    @Override
    public UserTable selectByPrimaryKey(Integer userId) {
        return userTableMapper.selectByPrimaryKey(userId);
    }

    @Override
    public List<UserTable> selectAll() {
        return userTableMapper.selectAll();
    }

    @Override
    public int updateByPrimaryKey(UserTable record) {
        return userTableMapper.updateByPrimaryKey(record);
    }

    @Override
    public UserTable phoneLogin(String phone) {
        return userTableMapper.phoneLogin(phone);
    }

    @Override
    public UserTable codeLogin(String code) {
        return userTableMapper.codeLogin(code);
    }

    @Override
    public List<UserTable> selectLimit(Integer form, Integer size) {
        PageHelper.startPage(form, size);
        return userTableMapper.selectAll();
    }

    @Override
    public int selectcount() {
        return userTableMapper.selectcount();
    }
}
